<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			var arr1 = [1, 2, 3, 3, 5, 6, 7]
			var arr2 = [0, 2, 3, 5, 7, 8, 9]
			var newArr = []
			for (var i = 0, j = 0; i < arr1.length && j < arr2.length; ) {
				if (arr1[i] < arr2[j]) {
					i++
				} else if (arr1[i] > arr2[j]) {
					j++
				} else {
					newArr.push(arr1[i])
					console.log(`arr1的第${i}个${arr1[i]}和arr2的第${j}个${arr2[j]}`)
					i++
					j++
				}
			}
			console.log(newArr)
		</script>
	</body>
</html>
